package main

import (
	"fmt"
	"reflect"
)

func main() {
	var x float64 = 3.14
	fmt.Println(reflect.ValueOf(x))
	fmt.Println(reflect.TypeOf(x))

	v := reflect.ValueOf(x)
	fmt.Println(v.Kind() == reflect.Float64)
	//通过接口类型变量获得反射类型对象
	var num3 float64 = 1.234
	val := reflect.ValueOf(num3)
	fmt.Print(val.Kind() == reflect.Float64)

	val2 := val.Interface().(float64)
	fmt.Printf("%T", val)
	fmt.Printf("%f,%T", val2, val2)

	var a interface{}
	a = "string"
	g, ok := a.(string)
	fmt.Println(g, ok)

}
